#include <iostream>
#include "fstream"

using namespace std;

class Person11 {
public:
    char name[64];
    int age;
};

void test01() {
    // 写入
    ofstream ofs;
    ofs.open("person.txt", ios::out | ios::binary);

    Person11 p = {"张三", 18};
    ofs.write((const char*)&p, sizeof(Person11));

    ofs.close();

    // 读取
    ifstream ifs;
    ifs.open("person.txt", ios::in | ios::binary);

    Person11 p1;
    ifs.read((char *)&p1, sizeof(Person11));

    cout << p1.name << endl;
}

int main() {
    test01();
}

